package com.fjec.activity.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fjec.activity.entity.BizActivitySeckillGift;
import com.fjec.activity.mapper.BizActivitySeckillGiftMapper;
import com.fjec.activity.service.IBizActivitySeckillGiftService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 005.秒杀活动礼物表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2020-09-18
 */
@Service
@Transactional
public class BizActivitySeckillGiftServiceImpl extends ServiceImpl<BizActivitySeckillGiftMapper, BizActivitySeckillGift> implements IBizActivitySeckillGiftService {

    @Resource
    private BizActivitySeckillGiftMapper mapper;

    @Override
    @Cacheable(value = "secKillGiftCache", key = "'fjec:seckill:gifts:' + #seckillId")
    public List<Map<String, Object>> getGiftsBySeckillId(Long seckillId) {
        return this.listMaps(new QueryWrapper<BizActivitySeckillGift>().eq("SecKillId", seckillId));
    }


}
